package top.hmtools.configurationManager;

import java.io.File;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 属性配置类，对应application.properties配置文件中的配置项
 * @author HyboJ
 * 创建日期：2017-9-26下午8:02:05
 */
@ConfigurationProperties(prefix = "hm_tools.js_css")
public class JsCssProperties {

	/**
	 * 获取合并javascript文件的请求uri
	 */
	private String js_uri;
	
	/**
	 * 获取合并css文件的请求uri
	 */
	private String css_uri;
	
	/**
	 * 手动刷新js缓存库的请求uri
	 */
	private String refresh_js_uri;
	
	/**
	 * 手动刷新css缓存库的请求uri
	 */
	private String refresh_css_uri;
	
	/**
	 * javascript文件所在的路径集合，以英文逗号分隔
	 */
	private String js_files_paths;
	
	/**
	 * css文件所在的路径集合，以英文逗号分隔
	 */
	private String css_files_paths;
	
	/**
	 * 文件内容编码格式
	 */
	private String encoding;
	
	/**
	 * 获取javascript文件缓存库所有文件名称的请求uri
	 */
	private String list_js_uri;
	
	/**
	 * 获取css文件缓存库所有文件名称的请求uri
	 */
	private String list_css_uri;

	public String getJs_uri() {
		return js_uri==null||"".equals(js_uri)?"/get_js":this.js_uri;
	}

	public void setJs_uri(String js_uri) {
		this.js_uri = js_uri;
	}

	public String getCss_uri() {
		return css_uri==null||"".equals(css_uri)?"/get_css":this.css_uri;
	}

	public void setCss_uri(String css_uri) {
		this.css_uri = css_uri;
	}

	public String getRefresh_js_uri() {
		return refresh_js_uri==null||"".equals(refresh_js_uri)?"/refresh_js":refresh_js_uri;
	}

	public void setRefresh_js_uri(String refresh_js_uri) {
		this.refresh_js_uri = refresh_js_uri;
	}

	public String getRefresh_css_uri() {
		return refresh_css_uri==null||"".equals(refresh_css_uri)?"/refresh_css":refresh_css_uri;
	}

	public void setRefresh_css_uri(String refresh_css_uri) {
		this.refresh_css_uri = refresh_css_uri;
	}

	public String getJs_files_paths() {
		if(this.js_files_paths == null || "".equals(js_files_paths)){
			String projectPath = System.getProperty("user.dir");
			String result = projectPath + File.separator + "hm_javascript"+File.separator;
			File tmp = new File(result);
			if(!tmp.exists()){
				tmp.mkdirs();
			}
			return result;
		}else{
			return js_files_paths;
		}
	}

	public void setJs_files_paths(String js_files_paths) {
		this.js_files_paths = js_files_paths;
	}

	public String getCss_files_paths() {
		if(this.css_files_paths == null || "".equals(css_files_paths)){
			String projectPath = System.getProperty("user.dir");
			String result = projectPath + File.separator + "hm_css"+File.separator;
			File tmp = new File(result);
			if(!tmp.exists()){
				tmp.mkdirs();
			}
			return result;
		}else{
			return css_files_paths;
		}
	}

	public void setCss_files_paths(String css_files_paths) {
		this.css_files_paths = css_files_paths;
	}

	/**
	 * 获取字符编码格式名称
	 * @return
	 */
	public String getEncoding() {
		return encoding==null||"".equals(encoding)?"UTF-8":encoding;
	}

	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}

	public String getList_js_uri() {
		return list_js_uri==null||"".equals(list_js_uri)?"/list_js":list_js_uri;
	}

	public void setList_js_uri(String list_js_uri) {
		this.list_js_uri = list_js_uri;
	}

	public String getList_css_uri() {
		return list_css_uri==null||"".equals(list_css_uri)?"/list_css":list_css_uri;
	}

	public void setList_css_uri(String list_css_uri) {
		this.list_css_uri = list_css_uri;
	}
	
	
	
}
